package practice.Day31;

/**
 * @Author quan
 * @Description 分解因数
 * @Date 2023/7/8 11:07
 */
import java.util.*;
public class Num2 {
    private static List<String> factorization(int a) {
        List<String> ans = new ArrayList<>();
        for (int i = 2; a > 1 && i * i <= a; i++) {
            while (a % i == 0) {
                ans.add(String.valueOf(i));
                a = a / i;
            }
        }
        if (a > 1) {
            ans.add(String.valueOf(a));
        }
        return ans;
    }
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        while (s.hasNextInt()) {
            int a = s.nextInt();
            List<String> factors = factorization(a);
            System.out.printf("%d = %s\n", a, String.join(" * ", factors));
        }
    }
}

